package com.chenyun.common.utils;

import cn.hutool.core.lang.Assert;
import com.chenyun.common.exceptions.BaseErrorCodeEnum;
import com.chenyun.common.exceptions.BusinessException;

/**
 * AssertUtil:
 *
 * @Author： Lonni
 * @Date： 2025/3/26  17:02
 */
public class AssertUtil extends Assert {


    public static <T> void notNull(T obj, BaseErrorCodeEnum errorCodeEnum) {
        if (obj == null) {
            throw new BusinessException(errorCodeEnum);
        }
    }

    public static void notBlank(String str, BaseErrorCodeEnum errorCodeEnum) {
        if (StringUtils.isBlank(str)) {
            throw new BusinessException(errorCodeEnum);
        }
    }


    public static void isTrue(boolean expression, BaseErrorCodeEnum errorCodeEnum) {
        if (!expression) {
            throw new BusinessException(errorCodeEnum);
        }
    }


}
